<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="../common/include/header.jsp" %>
<%@page import="board.QnaForm"%>


<div style="width:980px" id="qnaMain"> 
	<table style="" cellpadding="0" cellspacing="0" border="1">
		<%-- 왼쪽 메뉴--%>
			<tr>
				<td style="vertical-align: top;width: 180px;background-color:  #fdb73a;">
					<%@ include file="/common/include/leftmenu.jsp" %>
				</td>
		<%-- 오른쪽 게시판 글쓰기--%>	
					<td style="text-align: center;width: 800px">
						<html:form action="/qnaboard">				
						<%@include file="logo.jsp" %>	
						<div class="boardname">질문&답변게시판</div>
							<table style="width:700px;text-align: center;" cellpadding="0" cellspacing="0" border="0">
								<tr>
									<td style="width: 100px; padding-top:10px;text-align: center;font-weight: bold;">작성자</td>								
									<td style="width: 540px;text-align:center;padding-top: 10px;"><bean:write name="qnaForm" property="qbtitle"/></td>
								</tr>
								
								<logic:notEmpty name="qnaForm" property="qbdate">
									<tr>
										<td style="width:100px;">작성일</td>
										<td style="width: 540px;text-align:left;"><bean:write name="qnaForm" property="qbdate"/></td>
									</tr>
								</logic:notEmpty>
	
								<logic:notEmpty name="qnaForm" property="qbcounter">
									<tr>
										<td style="width: 100px;">조회수</td>
										<td style="width: 540px;text-align:left;"><bean:write name="qnaForm" property="qbcounter"/></td>
									</tr>
								</logic:notEmpty>
								
								<tr>
									<td style="width: 100px;">제목</td>
									<td style="width: 540px;text-align:left;"><html:text property="qbtitle" size="70"/></td>
								</tr>
								
								<tr>
									<td colspan="2" style="height: 500px;">
										<textarea name="qbcontent" rows="10" cols="80" style="width:800px; height: 500px">
											<bean:write name="qnaForm" property="qbcontent"/>	
										</textarea>
									</td>
								</tr>
								
								<tr>
									<td style="text-align: center;" colspan="2">
										<a href="javascript:validate();"><img src="<%=imagePath %>icon_update.jpg"/></a>
										<a href="javascript:goList();"><img src="<%=imagePath %>icon_list.jpg"/></a>
									</td>
								</tr>								
							</table>
							<input type="hidden" name="method" value="update"/>
							<input type="hidden" name ="qbno" value = "<bean:write name="qnaForm" property="qbno"/>"/>
							<input type="hidden" name ="qbrefno" value = "<bean:write name="qnaForm" property="qbno"/>"/>
							<input type="hidden" name ="mid" value = "<bean:write name="qnaForm" property="mid"/>"/>
							<input type="hidden" name ="qbtitle" value = "<bean:write name="qnaForm" property="qbtitle"/>"/>
							<input type="hidden" name ="qbcontent" value = "<bean:write name="qnaForm" property="qbcontent"/>"/>							
							<html:hidden property="qbno"/>
						</html:form>
					</td>		
<script type="text/javascript" src="<%=path%>/fckeditor/fckeditor.js"> </script>
<script type="text/javascript">
// fck 태그부분 처리
	window.attachEvent("onload", getfckeditor);
	 function getfckeditor(){
		var oFCKeditor = new FCKeditor( 'qbcontent' ) ;
		oFCKeditor.BasePath	= "<%=path%>/fckeditor/" ;
		oFCKeditor.ReplaceTextarea() ;
	}
	
//제목 유효성 검사
	function validate(){
		var title = qnaMain.getElementsByTagName('input')[0].value;
		var check = title.replace(/\s/g,"");

		if(check==""){			
			alert("제목은 반드시 입력해 주세요");
		}
		document.getElementById('qnaForm').submit();
	}
//목록 돌아가기

	function goList(){
		document.location  = "<%=path%>/board/qnaboard.do?method=list";
	}


</script>				
		</tr>
	</table>
</div>					

<%@ include file="../common/include/footer.jsp"%>
